package _4ChapterFore._4RemoveControlFlag;

import java.util.List;

public class UseBreakInsteadOfFlag {
    public void sendAlert(){}

    public void checkSecurity1(List<String> list){
        boolean find = false;
        for(String s:list){
            if(!find) {
                if ("trmp".equals(s)) {
                    sendAlert();
                    find = true;
                }
                if ("job".equals(s)) {
                    sendAlert();
                    find = true;
                }
            }
        }
    }

    public void checkSecurity2(List<String> list){
        for(String s:list){
            if ("trmp".equals(s)) {
                sendAlert();
                break;
            }
            if ("job".equals(s)) {
                sendAlert();
                break;
            }
        }


    }
}
